package pkg.andru.animation;

import android.util.SparseArray;

public class AnimeResourceCache {

    public static AnimeResourceCache mPool;

    public static AnimeResourceCache getInstance() {
        if (mPool == null) {
            mPool = new AnimeResourceCache();
        }
        return mPool;
    }

    private SparseArray<Frame> mFramePool = null;
    private SparseArray<Sprite> mSpritePool = null;

    private AnimeResourceCache() {
        mFramePool = new SparseArray<Frame>();
        mSpritePool = new SparseArray<Sprite>();
    }

    public void putFrame(Frame frame) {
        mFramePool.put(frame.getId(), frame);
    }

    public Frame getFrame(int id) {
        return mFramePool.get(id);
    }

    public void putSprite(Sprite sprite) {
        mSpritePool.put(sprite.getId(), sprite);
    }

    public Sprite getSprite(int id) {
        return mSpritePool.get(id);
    }

}
